package cn.HL.basic.Interceptor;

import cn.HL.basic.Interceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 拦截器配置类
 */
@Configuration
public class WebConfigurer implements WebMvcConfigurer {
    @Autowired
    private LoginInterceptor loginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //添加拦截类 告诉他哪个是拦截类
        registry.addInterceptor(loginInterceptor)
                //拦截那些
        .addPathPatterns("/**")
                //放行哪些
                .excludePathPatterns("/login/**")
                .excludePathPatterns("/user/register/**")
                .excludePathPatterns("/fastDfs/**")
                .excludePathPatterns("/verifyCode/**")
                .excludePathPatterns("/shop/activation/**")
                .excludePathPatterns("/shop/settlement");
    }



}